<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <input type="button" class="button" value="构造一个post请求">
    <script src="https://releases.jquery.com/git/jquery-git.min.js"></script>
    <script>
        let button = document.querySelector(".button");
        button.onclick = function () {
            $.ajax({
                type:"POST",
                url: "test",
                contentType:"application/x-www-form-urlencoded",
                data:"userId=10&classId=20",
                success:function(data,status){
                    console.log(data);
                }
            });
        }
    </script>
</body>
</html>